﻿create procedure [dbo].[usp_MachineUpdate]
	@MachineId int
	, @ConcurrencyId rowversion
	, @MachineName nvarchar(100)
	, @MachineIPAddress nvarchar(100)
	, @OperatingSystem nvarchar(100)
	, @ProcessorCount int
	, @InstalledMemory bigint
	, @InstalledMemorySpeed int
as

begin try
	
	begin transaction
	
		update [dbo].[Machine]
		set
			MachineName = @MachineName
			, MachineIPAddress = @MachineIPAddress
			, OperatingSystem = @OperatingSystem
			, ProcessorCount = @ProcessorCount
			, InstalledMemory = @InstalledMemory
			, InstalledMemorySpeed = @InstalledMemorySpeed
		where MachineId = @MachineId and ConcurrencyId = @ConcurrencyId
		
	commit transaction

end try
	
begin catch
	if @@trancount > 0
	begin
		rollback transaction;
	end
	execute [dbo].[usp_SqlErrorInsert]
end catch


